package week4;

public class Ex33 {
    public static int gcd (int m, int n){
        if (n == 0)
            return m;
        else return gcd(n, m % n);
    }

    public static void main(String[] args) {
        int c = 1, p = 1;
        int cs, cg, ps, pg;
        for (int i = 10; i <= 99; ++i){
            for (int j = i + 1; j <= 99; ++j){
                cs = i / 10;
                cg = i % 10;
                ps = j / 10;
                pg = j % 10;
                if (pg == 0) continue;
                if (cg == 0) break;
                if (cs == pg && ps * i == cg * j){
                    c *= cg;
                    p *= ps;
                }
                if (cg == ps && pg * i == cs * j){
                    c *= cs;
                    p *= pg;
                }
            }
        }
        int ans = p / gcd(c, p);
        System.out.println(ans);
    }
}
